(function(app){
	app
		.controller("content_33_checkCtrl",["$scope","$state","myFactory","$http","$stateParams","$state","$q","$ionicHistory",function($scope,$state,myFactory,$http,$stateParams,$state,$q,$ionicHistory){
			//参数接收
			var chdrnum01 = $stateParams.chdrnum01;
			var chdrcoy = $stateParams.chdrcoy;
			var state = $stateParams.state;//跳转路由
			var item33 = $stateParams.item33;//获取信息对象
			var policyData;
			var token=sessionStorage.getItem("token");
			//绑定数据到页面
			$scope.chdrnum01 = chdrnum01;
			$scope.showFlag = true; //控制前端是否显示“详情、重审、退出”三个功能，默认显示
			$scope.item33 = item33;
			$scope.endType;//用于显示选择类型
			if(item33.switchInd == 'Y'){
				$scope.endType = true;
			}else if(item33.switchInd == 'N'){
				$scope.endType = false;
			}
			
			//重新受理
			$scope.renew = function(){
				myFactory.renew();
			}	
			//退出移动保全
			$scope.exit = function(){
				myFactory.exit();
			}
			//返回上一页
			$scope.goBack = function(){
				myFactory.goBack();
			}
			
			//保单详情弹窗
			$scope.showPolicyDetail = function(){
				modal('open','policyModalOn33Check','overwindowOn33Check','policyCloseXOn33Check');
				var timestamp=myFactory.getTimetamp();
				var sfis= "chdrnum-chdrcoy-token-timestamp";
				var signStr="chdrnum="+chdrnum01+"&chdrcoy="+chdrcoy+"&token="+token+"&timestamp="+timestamp;//encodeURI(name)
				var sign = myFactory.hex(signStr);
				//初始化查询订单详情
				$http({
					method: 'GET',
					url: app.domain + 'query/restFindPolicyDetail.action',
					params: {'chdrnum': chdrnum01,'chdrcoy':chdrcoy,'sign':sign,'sfis':sfis,'token':token,'timestamp':timestamp }
				}).then(function successCallback(response) {
					if (response.data.success) {
						policyData = response.data.data;
						$scope.policyData = policyData;
						$scope.policyData.ptdate01=myFactory.DateTools($scope.policyData.ptdate01);
					}
				}, function errorCallback(response) {
					myFactory.alert("","初始化查询订单详情失败!","info");
				});

			}
			//保单详情弹窗关闭函数
			$scope.policyCancelOn33Check = function(){
				modal('close','policyModalOn33Check','overwindowOn33Check','policyCloseXOn33Check');
			}
			//关闭遮罩
			$scope.overwindowClose = function(){
				//$(".overwindow").show();
				$(".overwindow").hide();
				$(".overmodal").hide();
			}
			//根据路由判断是否要显示详情、重新受理、退出三个功能
			if("history_detail"==state){
				$scope.showFlag = false;//不显示
			}
		}]);   
		//指针弹窗
		app.directive('infoid',function(){
			return {
				restrict: 'EA',		//指明指令在DOM里面以什么形式被声明,EA.表示即可以是元素也可以是属性
				templateUrl: 'html/input/content_base_info.html'+app.clearCache,
				replace: true,		//设置解析后，DOM声明的指令是否消失
				link: function(scope,element,attrs){  //链接函数负责注册DOM事件和更新DOM,
					console.log('指令完成');
				}
			}
		});
})(app)